package com.fancy.learncenter.ui.view;

import android.app.Activity;
import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.fancy.learncenter.R;
import com.fancy.learncenter.bean.TeachersBean;
import com.fancy.learncenter.common.MyApplication;

/**
 * Created by Hyy on 2017/2/24.
 */

public class CartoonTeacherPopupWindow extends BasePopupWindow {
    public CartoonTeacherPopupWindow(Activity mContext) {
        super(mContext);
        this.mContext = mContext;
        initPopup();
    }

    View popopView;
    Activity mContext;

    private void initPopup() {
        popopView = LayoutInflater.from(mContext).inflate(R.layout.popupwindow_cartoon_teacher_detail, null);


        name = popopView.findViewById(R.id.name);
        mobile = popopView.findViewById(R.id.mobile);
        simpleDraweeView = popopView.findViewById(R.id.simpleDraweeView);

        popopView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                dismiss();
            }
        });

        setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
        setHeight(ViewGroup.LayoutParams.MATCH_PARENT);

        setOutsideTouchable(false);

        setContentView(popopView);
    }

    TextView name;
    TextView mobile;
    SimpleDraweeView simpleDraweeView;

    @Override
    public void showPopupWindow() {
        super.showPopupWindow();
        showAtLocation(popopView, Gravity.CENTER, 0, 0);
    }

    public void setData(TeachersBean teachersBean) {
        mobile.setText(teachersBean.getMobile());
        name.setText(teachersBean.getName());
        simpleDraweeView.setImageURI(teachersBean.getImageUrl());
    }
}
